﻿using B.S.DataBase.ErrorCode;
using B.S.DataBase.Write.API.Application.Commands;
using B.S.DataBase.Write.API.Application.Commands.Update;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.DataBase.Write.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ProductController : ControllerBase
    {
        private readonly IMediator mediator;

        public ProductController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 基本信息新增
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> AddProduct(CreateProductCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 商品新增
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> AddProductType(CreateProductTypeCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 养殖信息(新增)
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> AddFarm(CreateFarmCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 免疫信息新增
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> AddImmune(CreateImmuneCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 企业信息(养殖场添加)
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> AddFirm(CreateFirmCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 屠宰信息新增
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> AddKIll(CreateKillCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 企业信息(公司新增)
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> AddGongsi(CreateFirmGongsiCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 深加工新增(公司名称)
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> Addprocessing(CreateprocessingCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 供应商信息(原料-辅料-添加剂)
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> AddSupplier(CreateSupplierCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 企业新增(班组-负责人)
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> AddTeam(CreateTeamCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 修改商品表
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> UpdateProduct(UpdateProductCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 修改保健信息()
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> UpdateImmune(UpdateImmuneCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 逻辑删除商品信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpDelete]
        public async Task<APIResult<int>> DeletedProduct(DeletedProductCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 保健信息删除
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpDelete]
        public async Task<APIResult<int>> DeletenImmune(DeletedImmuneCommand request)
        {
            return await mediator.Send(request);
        }
       
       
    }
}
